package com.wgchao.authmanager.application.vo;

import com.wgchao.authmanager.domain.model.MenuResource;
import com.wgchao.authmanager.infrastructure.exception.ObjectNotMatchingException;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.io.Serializable;

/**
 * @ClassName: AuthoHandleVo
 * @author: wgchao
 * @createTime: 2020/5/9 7:34 PM
 * @Description: TODO
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@ToString
public class AuthoHandleVo implements Serializable {
    private String handleIdentify;
    private String handleName;

    @Override
    public int hashCode() {
        int result = handleIdentify != null ? handleIdentify.hashCode() : 0;
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if(!(obj instanceof AuthoHandleVo)){
            throw new ObjectNotMatchingException("操作资源类型错误");
        }
        AuthoHandleVo authoHandleVo = (AuthoHandleVo) obj;
        if(this.handleIdentify.equals(authoHandleVo.handleIdentify)){
            return true;
        }
        return false;
    }
}
